#ifndef __SYNTAX_ERROR_FORMATTER_H__
#define __SYNTAX_ERROR_FORMATTER_H__

#include "syntax_error_list.h"
#include "antlr4-runtime.h"
namespace cyclone::parser
{
    class SyntaxErrorFormmatter
    {
    public:
        template <auto code>
        static auto formatErrorMessage()
        {
            return code;
        }

        template <auto code>
        static auto formatErrorMessage(const std::string &info)
        {
            return info.size() ? (code + ":" + info) : code;
        }
        template <auto code>
        static auto formatErrorMessage(antlr4::Token *token)
        {
            return token ? (code + ":" + token->getText()) : code;
        }
    };

    template <>
    auto SyntaxErrorFormmatter::formatErrorMessage<USE_KEYWORD_AS_IDENTIFIER>(const std::string &info)
    {
        return "The keyword " + info + " is reserved";
    }
    template <>
    auto SyntaxErrorFormmatter::formatErrorMessage<USE_KEYWORD_AS_IDENTIFIER>(antlr4::Token *token)
    {
        return token ? ("The keyword " + token->getText() + " is reserved") : "Using reserved keyword as identifier";
    }
    template <>
    auto SyntaxErrorFormmatter::formatErrorMessage<USING_RESERVED_KEYWORD>(const std::string &info)
    {
        return "The keyword " + info + " is reserved";
    }

} // namespace cyclone::parser

#endif // __SYNTAX_ERROR_FORMATTER_H__
